﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="map.Controls.test" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <iframe name="checkUpFrame" id="checkUpFrame" src ="RandomCheckupCoding.aspx?count=6&key=test" frameborder="0" marginheight ="0" marginwidth ="0" width="84px" height="20px"></iframe>
        <a href ="#" onclick="refreshCheckup();">看不清楚，换一张</a>
        
        <br />
        
        <img id="checkupImg"  src="RandomCheckupCoding.aspx?count=6&key=test"/>
        <a href ="#1" onclick ="refreshCheckupImg();">看不清楚，再换一张</a>
    </div>
    
    <hr />
    
    <div>
        <span id="DisplaySpan"></span><br />
        <input  type="button" value="Get" onclick ="GetAjax();"/>
        <input type="button" value="Set" onclick ="SetAjax();"/>
    </div>
    </form >
        
     
    <script type="text/javascript">
        function refreshCheckup() {
            var checkUpFrame = document.getElementById("checkUpFrame");
            var result = AjaxFunction.GetSessionValue("test_checkcode");
            //alert(result.value);
            checkUpFrame.contentWindow.location.reload();
        }
        function refreshCheckupImg() {
            var checkupImg = document.getElementById("checkupImg");
            checkupImg.src = "RandomCheckupCoding.aspx?count=6&key=test&dd="+Date().toString ();
        }

        var stu;
        
        function GetAjax() {
            TestAjaxClass.GetStudent(AjaxSuccess);
        }
        function AjaxSuccess(result) {
            stu = result.value;
            document.getElementById("DisplaySpan").innerHTML = result.value. Name;
        }

        function SetAjax() {
            var result = TestAjaxClass.SetStudent(stu);           
            document.getElementById("DisplaySpan").innerHTML = result.value.Name;
            
        }
    </script>
</body>
</html>
